Commit
8e29babca8adc677 switched to `findLastIndex()` to find
the previous point, which inadvertently changed what value is
returned for invalid input.
Restore the old fallback value and log a stacktrace, so we can
hopefully track down what causes the invalid input.
Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8856
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4062>
}
_findPreviousPoint(pos) {
- return this._snapPoints.findLastIndex(p => p <= pos);
+ const index =
+ this._snapPoints.findLastIndex(p => p <= pos);
+ if (index !== -1)
+ return index;
+
+ console.trace(`Invalid position ${pos}`);
+ // also out-of-bounds, but somehow callers fail less hard than with -1
+ return this._snapPoints.length;
}
_findPointForProjection(pos, velocity) {